package cn.fl.flow.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.flow.vo.FlowBranchVO;
import flow.business.facade.flow.dto.FlowBranchDTO;


import java.util.ArrayList;
import java.util.List;

public class FlowBusinessBranchVOTransform {

	/**
	 * DTO 转  VO
	 * @param dto SequenceFlowDTO
	 * @return SequenceFlowVO
	 */
	public static FlowBranchVO toVO(FlowBranchDTO dto) {
		FlowBranchVO vo = null;
		if (dto != null) { 
			vo = new FlowBranchVO();
			vo.setFlowKey(dto.getFlowKey());
			vo.setFlowName(dto.getFlowName());
			vo.setIsFormAuth(dto.getIsFormAuth());
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param vo SequenceFlowVO
	 * @return SequenceFlowDTO
	 */
	public static FlowBranchDTO toDTO(FlowBranchVO vo) {
		FlowBranchDTO dto = null;
		if (vo != null) {
			dto = new FlowBranchDTO();
			dto.setFlowKey(vo.getFlowKey());
			dto.setFlowName(vo.getFlowName());
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param list List<SequenceFlowVO>
	 * @return List<SequenceFlowDTO>
	 */
	public static List<FlowBranchVO> toVOList(List<FlowBranchDTO> list) {
		List<FlowBranchVO>  voList = new ArrayList<FlowBranchVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (FlowBranchDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	public static List<FlowBranchDTO> toDTOList(List<FlowBranchVO> list) {
		List<FlowBranchDTO>  dtoList = new ArrayList<FlowBranchDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (FlowBranchVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
	
}
